package com.project.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.PersonBase.MouseBean;
import com.project.service.IMouseService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RequestMapping("mouse")
@RestController
public class MouseController {

    @Resource
    private IMouseService mouseService;


    @RequestMapping("findCutMouse")
    public IPage<MouseBean> findCutMouse(@RequestParam(value = "pageNo",defaultValue = "1") int pageNo, @RequestParam(value = "pageSize",defaultValue = "3") int pageSize, String mouseName){

        IPage<MouseBean> page = mouseService.findCutMouse(pageNo,pageSize,mouseName);

        return page;
    }


    @RequestMapping("addMouse")
    public String addMouse (MouseBean mouseBean){

        if (mouseBean != null){
            mouseService.addMouse(mouseBean);
        }

        return "ok";
    }

    @RequestMapping("findMouseById")
    public MouseBean findMouseById(int mouseId){

      MouseBean mouseBean =  mouseService.findMouseById(mouseId);

      return mouseBean;
    }
}
